From 7da1cbc78c071c80cbd53f8c96baeee49ac20f59 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Sun, 3 Aug 2014 22:04:45 +0200 Subject: [PATCH] Fix backlink for RevertAction RevertAction::getDescription cannot set subtitle on OutputPage, because the subtitle on OutputPage gets cleared before the result of getDescription is added and than the subtitle is gone. Refactored the code for building the backlink into a static function and use it. Change-Id: Iedad0b8e040035a9a10a0b140d2322357e6b539a --- includes/OutputPage.php | 20 ++++++++++++++++---- includes/actions/RevertAction.php | 4 +--- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/includes/OutputPage.php b/includes/OutputPage.php index fb2d6f4156..32948844c8 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -1033,17 +1033,29 @@ class OutputPage extends ContextSource { } /** - * Add a subtitle containing a backlink to a page + * Build message object for a subtitle containing a backlink to a page * * @param Title $title Title to link to * @param array $query Array of additional parameters to include in the link + * @return Message + * @since 1.25 */ - public function addBacklinkSubtitle( Title $title, $query = array() ) { + public static function buildBacklinkSubtitle( Title $title, $query = array() ) { if ( $title->isRedirect() ) { $query['redirect'] = 'no'; } - $this->addSubtitle( $this->msg( 'backlinksubtitle' ) - ->rawParams( Linker::link( $title, null, array(), $query ) ) ); + return wfMessage( 'backlinksubtitle' ) + ->rawParams( Linker::link( $title, null, array(), $query ) ); + } + + /** + * Add a subtitle containing a backlink to a page + * + * @param Title $title Title to link to + * @param array $query Array of additional parameters to include in the link + */ + public function addBacklinkSubtitle( Title $title, $query = array() ) { + $this->addSubtitle( self::buildBacklinkSubtitle( $title, $query ) ); } /** diff --git a/includes/actions/RevertAction.php b/includes/actions/RevertAction.php index 6481630e11..d025878491 100644 --- a/includes/actions/RevertAction.php +++ b/includes/actions/RevertAction.php @@ -144,8 +144,6 @@ class RevertAction extends FormAction { } protected function getDescription() { - $this->getOutput()->addBacklinkSubtitle( $this->getTitle() ); - - return ''; + return OutputPage::buildBacklinkSubtitle( $this->getTitle() ); } } -- 2.20.1